//
//  UIImageView+LZExtension.m
//  百思不得姐
//
//  Created by 郝庆 on 16/5/28.
//  Copyright © 2016年 haoqing. All rights reserved.
//

#import "UIImageView+LZExtension.h"
#import "UIImage+LZExtension.h"
#import <UIImageView+WebCache.h>

@implementation UIImageView (LZExtension)
- (void)lz_setHeader:(NSString *)url
{
    [self lz_setCircleHeader:url];
}

- (void)lz_setCircleHeader:(NSString *)url
{
    UIImage *placeholder = [UIImage lz_circleImageName:@"defaultUserIcon"];
    [self sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:placeholder completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
        if (image == nil) return;
        
        self.image = [image lz_circleImage];
    }];
}

- (void)lz_setRectHeader:(NSString *)url
{
    UIImage *placeholder = [UIImage imageNamed:@"defaultUserIcon"];
    [self sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:placeholder];
}

@end
